var life_style = ['话费', '机票', '电影票', '游戏', '彩票', '加油卡', '酒店', '火车票', '众筹', '理财', '礼品卡', '白条'];
var life_href = ['话费', '机票', '电影票', '游戏', '彩票', '加油卡', '酒店', '火车票', '众筹', '理财', '礼品卡', '白条'];

onload = function () {
    var ele = this.document.getElementById("nav-menu").querySelectorAll("a");
    for (var i = 0; i < life_style.length; i++) {
        ele[i].href = life_href[i];
        ele[i].innerText = life_style[i];
        ele[i].style.backgroundPositionX = -60 * (i % 4) + "px";
        ele[i].style.backgroundPositionY = -70 * parseInt(i / 4) - 5 + "px";

    }
}